package view.panel;

import java.awt.FlowLayout;
import java.util.ArrayList;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class OrderPanel extends JPanel {
	
	JTextField jfieldYear, jfieldMonth, jfieldDay, jfieldCustomId;
	JLabel jlabelYear, jlabelMonth, jlabelDay, jlabelCustomId, jlabelMenu;
	ArrayList<JCheckBox> menuList;
	JButton jbtnOrder, jbtnCancel;
	
	public OrderPanel() {
		
		setLayout(new FlowLayout(FlowLayout.LEFT, 10, 30));
		setSize(300,200);
		setVisible(true);
		
		jfieldYear = new JTextField(4);
		jfieldMonth = new JTextField(2);
		jfieldDay = new JTextField(2);
		jfieldCustomId = new JTextField(4);
		
		jlabelYear = new JLabel("년");
		jlabelMonth = new JLabel("월");
		jlabelDay = new JLabel("일");
		jlabelCustomId = new JLabel("고객번호");
		jlabelMenu = new JLabel("메뉴");
		
		jbtnOrder = new JButton("주문");
		jbtnCancel = new JButton("취소");
		
		menuList = new ArrayList<JCheckBox>();
		
		addMenu("김밥");
		addMenu("떡볶이");
		addMenu("순대");
		addMenu("오뎅");
		addMenu("튀김");
	
		add(jfieldYear);
		add(jlabelYear);
		add(jfieldMonth);
		add(jlabelMonth);
		add(jfieldDay);
		add(jlabelDay);
		add(jlabelCustomId);
		add(jfieldCustomId);
		add(jlabelMenu);
		
		registMenu();
		
		add(jbtnOrder);
		add(jbtnCancel);
		
	}
	
	private void addMenu(String menuName) {
		
		JCheckBox checkMenu = new JCheckBox(menuName);
		
		menuList.add(checkMenu);		
	}
	
	private void registMenu() {
		
		for(int i = 0; i < menuList.size(); ++i) {
			this.add(menuList.get(i));			
		}
	
	}

}
